package com.changgou.seckill.service.impl;

import com.changgou.seckill.dao.SecKillTimeMapper;
import com.changgou.seckill.pojo.SecKillTime;
import com.changgou.seckill.service.SecKillTimeService;
import org.apache.ibatis.annotations.Param;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.List;

@Service
public class SecKillTimeServiceImpl implements SecKillTimeService {
    @Autowired
    private SecKillTimeMapper secKillTimeMapper;

    @Override
    public void deleteId(Integer id) {
        secKillTimeMapper.deleteByPrimaryKey(id);
    }

    /**
     * 删除活动与商品之间的关联
     * @param id
     */
    @Override
    public void delete(Long id) {
        secKillTimeMapper.deleteByTimeId(id);
    }

    @Override
    public void updataTime(Integer id, Integer statrus) {
        secKillTimeMapper.updataTime(id,statrus);
    }


    @Override
    public List<SecKillTime> selectTime() {
        List<SecKillTime> timeList = secKillTimeMapper.selectAll();
        return timeList;
    }

    /**
     * 活动添加商品
     * @param time_id
     * @param goods_ids
     */
    @Override
    public void addSeckillGoods( Integer time_id,  List<Integer> goods_ids) {
        secKillTimeMapper.addSeckillGoods(time_id,goods_ids);
    }
}
